﻿
@model CloudStorageLight.Core.Web.FileTransferVM
@{
    Layout = null;
}
<div style="height:100%;width:100%;overflow:hidden;">
    @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "fileTransferForm" }))
    {
        <div>
            <table style="width:100%;">
                <tr>
                    <th>@CloudStorageLight.Core.Web.ViewMessages.MsgMailTo</th>
                    <td colspan="3">@Html.TextAreaFor(x => x.To, new { style = "width:100%;", placeholder="jone@sample.com; taro@foo.co.jp" })</td>
                </tr>
                <tr>
                    <th>@CloudStorageLight.Core.Web.ViewMessages.MsgMailBCC</th>
                    <td colspan="3">@Html.CheckBoxFor(x => x.Bcc)</td>
                </tr>
                <tr>
                    <th>@CloudStorageLight.Core.Web.ViewMessages.MsgMailTitle</th>
                    <td colspan="3">@Html.TextBoxFor(x => x.Title, new { style = "width:100%;" })</td>
                </tr>
                <tr>
                    <th>@CloudStorageLight.Core.Web.ViewMessages.MsgMailPassword</th>
                    <td colspan="3">
                        <spn>@Html.TextBoxFor(x => x.Password, new { style = "width:200px;" })</spn>
                        @*<spn>@Html.TextBoxFor(x => x.Password, new { style = "width:200px;", @class = "password" })<i id="open-icon" class="icon-eye"></i></spn>*@
                    </td>
                </tr>
                <tr>
                    <th>@CloudStorageLight.Core.Web.ViewMessages.MsgMailExpired</th>
                    <td colspan="3">
                        @Html.TextBoxFor(x => x.Expired, "{0:yyyy/MM/dd}", new { style = "width:150px;" })
                        @CloudStorageLight.Core.Web.ViewMessages.MsgMailReminderTimes
                        @Html.TextBoxFor(x => x.RemainderTimes, new { style = "width:50px;" })
                    </td>
                </tr>
                <tr>
                    <th>@CloudStorageLight.Core.Web.ViewMessages.MsgFileReciveMode</th>
                    <td colspan="3">
                        @Html.DropDownListFor(x => x.FileReciveMode, Model.FileReciveModeList)
                    </td>
                </tr>
            </table>
            <table style="width:100%;">
                <tr>
                    <td colspan="2">
                        <h4>@CloudStorageLight.Core.Web.ViewMessages.MsgSendFiles</h4>
                        <div style="height:80px;overflow:auto;font-size:1.1em;">
                            <ul id="attachments" class="send-mail-files"></ul>
                        </div>
                    </td>
                    <td colspan="2">
                        <div style="height:80px;overflow:auto;">
                            @Html.ValidationSummary("", new { @class = "text-danger" })
                        </div>
                    </td>
                </tr>

            </table>


            <h4>@CloudStorageLight.Core.Web.ViewMessages.MsgMailBody</h4>
            @Html.TextAreaFor(x => x.MailBody, new { style = "width:100%;height:100px;" })
        </div>
        <button id="sendButton" type="button">@(CloudStorageLight.Core.Web.ViewMessages.MsgSend)</button>
        <button id="closeButton" type="button">@(CloudStorageLight.Core.Web.ViewMessages.MsgCancel)</button>
        @Html.HiddenFor(x => x.WorkTaskId)
        @Html.HiddenFor(x=>x.ReciveBaseDirectory)
    }

    <script type="text/javascript">
        $(function () {
            $('.password').attr('type', 'password');
            $('#open-icon').unbind().hover(function () {
                $('.password').attr('type', 'text');
            }, function () {
                $('.password').attr('type', 'password');
            });
            $("#Expired").datepicker({dateFormat: 'yy/mm/dd'});

            $(".item-checkbox:checked").each(function (idx) {
                $("#attachments").append("<li>" + $(this).closest("tr").find(".item-name").text() + "</li>");
                $("#fileTransferForm").append("<input type='hidden' value='" + $(this).attr("name") + "' name='Files[" + idx.toString() + "]'>");
            });

            $("#sendButton").click(function () {
                CloudStorageLight.StorageController.sendMailTransferFile();
            });

            $("#closeButton").click(function () {
                CloudStorageLight.StorageController.closetransferFileDialog();
            });

        });

    </script>
</div>
